/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mail;

import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;

/**
 *
 * @author williambartko
 */
public class Email {

    private String emailGmail = "edwebsoftwares@gmail.com";
    private String senhaGmail = "senha123";

    public Email(String emailDestinatario, String titulo, String mensagem) throws EmailException {

        SimpleEmail email = new SimpleEmail();


        email.setDebug(true);
        email.setHostName("smtp.gmail.com");
        email.setAuthentication(emailGmail, senhaGmail);
        email.setSSL(true);
        email.addTo(emailDestinatario); //pode ser qualquer um email
        email.setFrom(emailGmail); //aqui necessita ser o email que voce fara a autenticacao
        email.setSubject(titulo);
        email.setMsg(mensagem);
        email.send();


    }
}
